home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
gfx
/
fract
/
FlashMandel.lha
/
FlashMandel
/
Sources
/
Modules
/
MandReal.S
< prev
next >
Wrap
Text File
|
1999-01-22
|
4KB
|
102 lines
************************************************************************
** Written by Dino Papararo 23-Sep-1998
**
** FUNCTION
**
** MandReal -- perform Z = Z^2 + C iteration.
**
** SYNOPSIS
**
** WORD MandFPU (WORD Iterations,long double Cre,long double Cim)
**
**
** DESCRIPTION
**
** C equivalent function:
**
** ***************************************************************
** *WORD Real (WORD Iterazioni,long double Cre,long double Cim)***
** *{ ***
** *register long double zr,zi,zi2,dist,maxdist; ***
** * ***
** * zi = Cim; ***
** * ***
** * zr = Cre; ***
** * ***
** * maxdist = 4; ***
** * ***
** * do { ***
** * zi2 = zi; ***
** * ***
** * zi *= zr; ***
** * ***
** * zr *= zr; ***
** * ***
** * zi2 *= zi2; ***
** * ***
** * dist = zr; ***
** * ***
** * dist += zi2; ***
** * ***
** * if (dist > maxdist) return Iterazioni; ***
** * ***
** * zi += zi; ***
** * ***
** * zr -= zi2; ***
** * ***
** * zi += Cim; ***
** * ***
** * zr += Cre; ***
** * ***
** * } while (-- Iterazioni); ***
** * ***
** * return 0; ***
** *} ***
** ***************************************************************
**
** This function tests if a point belongs or not at mandelbrot's set
**
** Optimized for pipelines of 68882+ coprocessors
**
** NOTICE: ALL VARIABLES ARE INTO REGISTERS FOR FULL SPEEEED
**
** d0:Iterations
**
** fp0:Cre fp1:Cim fp2:Zr fp3:Zi fp4:Zi2 fp5:Dist fp6:MaxDist
************************************************************************
XDEF _MandFPU
_MandFPU:
fmove.x fp1,fp3 * Zi = Cim
fmove.x fp0,fp2 * Zr = Cre
fmove.b #4,fp6 * MaxDist = 4
Loop:
fmove.x fp3,fp4 * zi2 = zi
fmul.x fp2,fp3 * zi = zr * zi
fmul.x fp2,fp2 * zr = zr * zr
fmul.x fp4,fp4 * zi2 *= zi
fmove.x fp2,fp5 * dist = zr
fadd.x fp4,fp5 * dist += zi2
fcmp.x fp6,fp5 * cmp MaxDist dist
fbgt.w Exit * if dist > MaxDist exit
fadd.x fp3,fp3 * zi += zi
fsub.x fp4,fp2 * zr -= zi2
fadd.x fp1,fp3 * zi += Cim
fadd.x fp0,fp2 * zr += Cre
dbra.w d0,Loop * if --Iterations go to Loop
moveq.l #0,d0 * Iterations = 0
Exit:
rts * return Iterations
end